//
//  UnicodeStr.m
//  GOSProject
//
//  Created by 叶一枫 on 2017/3/7.
//  Copyright © 2017年 yeyifeng. All rights reserved.
//

#import "UnicodeStr.h"

@implementation UnicodeStr

+(NSString*)getUtf8StrWithUnicode:(NSString*)unicodeStr{
    
    if (!unicodeStr||[unicodeStr isEqualToString:@""]) return @"";
    
    //Unicode 解编码
    NSString *tempStr1 = [unicodeStr stringByReplacingOccurrencesOfString:@"\\u" withString:@"\\U"];
    NSString *tempStr2 = [tempStr1 stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
    NSString *tempStr3 = [[@"\"" stringByAppendingString:tempStr2] stringByAppendingString:@"\""];
    NSData *tempData = [tempStr3 dataUsingEncoding:NSUTF8StringEncoding];
    
    NSString* Utf8Str  = [NSPropertyListSerialization propertyListWithData:tempData options:NSPropertyListImmutable format:NULL error:NULL];
    
    return Utf8Str;
}

@end
